package com.guoxue.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.guoxue.dao.IAlbumDao;
import com.guoxue.domain.AlbumVo;
@Repository
public class AlbumDaoImpl extends BaseDaoImpl<AlbumVo> implements IAlbumDao {

	@Override
	public int countAlbumByUid(int uid) {
		return count("SELECT count(*) FROM AlbumVo a WHERE a.uid=? AND a.sysflag=0", new Object[]{uid}).intValue();
	}

	@Override
	public void saveAlbum(AlbumVo al) {
		saveOrUpdate(al);
	}

	@Override
	public AlbumVo getAlbumByKey(int photoId) {
		return get("FROM AlbumVo a WHERE a.id=? AND a.sysflag=0", new Object[] {photoId});
	}

	@Override
	public List<AlbumVo> getPhotosList(Integer uid) {
		return find("FROM AlbumVo a WHERE a.uid=? AND sysflag=0", new Object[]{uid});
	}
	
}
